<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <p>时间的格式化</p>
    <p>完整时间：{{xzTime | filterT}}</p>
    <p>年月日：{{xzTime | filterT('YYYY-MM-DD')}}</p>
    <p>时分秒：{{xzTime | filterT('HH:mm:ss')}}</p>
</div>

<script src="https://cdn.bootcdn.net/ajax/libs/moment.js/2.29.1/moment.js"></script>
<script src="../js/vue.js"></script>
<script>
    Vue.filter('filterT', function (value, format = 'YYYY-MM-DD HH:mm:ss') {
        return moment(value).format(format)
    })
    new Vue({
        el: '#app',
        data: {
            xzTime: new Date()
        }
    })
</script>
</body>
</html>